
//
//  OAMeCenterCell.m
//  OA项目
//
//  Created by innofive on 2018/4/12.
//  Copyright © 2018年 inno. All rights reserved.
//

#import "OAMeCenterCell.h"
#import "SevenSwitch.h"
@implementation OAMeCenterCell

-(void)onAsInitAddView:(UIView *)view forViewController:(UIViewController *)ViewController forDataSource:(id)dataSource AtIndexPath:(NSIndexPath *)indexPath
{
    self.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    
    if (indexPath.section==1) {
        self.hasBottomLine = YES;
    }
    
}

-(void)update:(NSDictionary *)model forTableView:(UITableView *)tableView AtIndexPath:(NSIndexPath *)indexPath
{
    self.imageView.image = IMAGE(model[@"image"]);
    self.textLabel.text = model[@"title"];
}

@end




@implementation OAMeCenterCell1

-(void)onAsInitAddView:(UIView *)view forViewController:(UIViewController *)ViewController forDataSource:(id)dataSource AtIndexPath:(NSIndexPath *)indexPath
{
    self.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    
    
    self.textLabel.textColor =[UIColor blackColor];
    
  //  WSELF(weakSelf);
    if (indexPath.section==1) {
        self.hasBottomLine = YES;
        
//        [self  onMainSetSubViewFrame:^(UIView *view, CGPoint origin, CGSize size, CGPoint center) {
//
//            [weakSelf.textLabel sizeToFit];
//
//        }];
    }
    else
    {
        UIButton *button = ({
            UIButton *l = [UIButton buttonWithType:UIButtonTypeCustom];
//            l.enabled = NO;
            l.cornerRadius = 3;
            l.masksToBounds = YES;
            //l.backgroundColor = [UIColor redColor];
            [l setNormalImage:IMAGE(@"mine _icon_account security_Account protection")];
            [l setNormalTitle:@"已保护"];
            l.titleLabel.font = kSysFont(kFitW(12));
            [l setNormalTitleColor:hexCOLOR(@"A9A9A9")];
            //l.titleLabel.textAlignment = NSTextAlignmentRight;
            //[l setTitleTextAlignment:UIControlContentHorizontalAlignmentRight];
            l;
        });
    
        [view addV:button];
        
        [self  onMainSetSubViewFrame:^(UIView *view, CGPoint origin, CGSize size, CGPoint center) {
//            [weakSelf.textLabel sizeToFit];
//            [button sizeToFit];
            button.size = CGSizeMake(kFitW(60), size.height);
//            button.left = 100;
            button.right = size.width-kFitW(35);
            button.centerY = size.height/2;
            [button layoutButtonWithEdgeInsetsStyle:(MKButtonEdgeInsetsStyleLeft) imageTitleSpace:3];
            
        }];
        
    }
    
    
}

-(void)update:(NSDictionary *)model forTableView:(UITableView *)tableView AtIndexPath:(NSIndexPath *)indexPath
{
    self.textLabel.text = model[@"title"];
}

@end


@implementation OAMeCenterCell2

-(void)onAsInitAddView:(UIView *)view forViewController:(UIViewController *)ViewController forDataSource:(id)dataSource AtIndexPath:(NSIndexPath *)indexPath
{

    self.textLabel.textColor =[UIColor blackColor];
    
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    
    SevenSwitch *button = ({
        SevenSwitch *l = [[SevenSwitch alloc]init];
        l.onColor = hexCOLOR(@"D3A351");
//        erty (nonatomic, strong) UIColor *inactiveColor;
//
//        /*
//         *    Sets the background color that shows when the switch off and actively being touched.
//         *  Defaults to light gray.
//         */
//        @property (nonatomic, strong) UIColor *activeColor;
//
//        /*
//         *    Sets the background color that shows when the switch is on.
//         *  Defaults to green.
//         */
//        @property (nonatomic, strong) UIColor *onColor;
//
//        /*
//         *    Sets the border color that shows when the switch is off. Defaults to light gray.
//         */
//        @property (nonatomic, strong) UIColor *borderColor;
//
//        /*
//         *    Sets the knob color. Defaults to white.
//         */
//        @property (nonatomic, strong) UIColor *knobColor;
//
//        /*
//         *    Sets the shadow color of the knob. Defaults to gray.
//         */
//        @property (nonatomic, strong) UIColor *shadowColor;
        l;
    });
    
    [view addV:button];
    
    [self  onMainSetSubViewFrame:^(UIView *view, CGPoint origin, CGSize size, CGPoint center) {
        button.size = CGSizeMake(kFitW(50),kFitH(25));
        //            button.left = 100;
        button.right = size.width-kFitW(10);
        button.centerY = size.height/2;
    }];
        
    
}

-(void)update:(NSDictionary *)model forTableView:(UITableView *)tableView AtIndexPath:(NSIndexPath *)indexPath
{
    self.textLabel.text = model[@"title"];
}

@end




@implementation OAMeCenterCell3

-(void)onAsInitAddView:(UIView *)view forViewController:(UIViewController *)ViewController forDataSource:(id)dataSource AtIndexPath:(NSIndexPath *)indexPath
{
    
    self.backgroundColor = [UIColor clearColor];
    
    self.textLabel.textColor = hexCOLOR(@"B2B2B2");
    
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    
    self.textLabel.text = @"开启账号保护后,在不常用额手机上登录系统,需要通过短信验证你的手机号码";
    self.textLabel.font = kSysFont(kFitW(12));
    self.textLabel.numberOfLines = 0;
    
    WSELF(weakSelf);
    [self  onMainSetSubViewFrame:^(UIView *view, CGPoint origin, CGSize size, CGPoint center) {
        weakSelf.textLabel.frame = CGRectMake(kFitW(15),kFitH(10), size.width-kFitW(30),size.height-kFitH(10));
    }];
    
    
}



@end



@implementation OAMeCenterCell4

-(void)onAsInitAddView:(UIView *)view forViewController:(UIViewController *)ViewController forDataSource:(id)dataSource AtIndexPath:(NSIndexPath *)indexPath
{
    
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    
    self.textLabel.text = @"iphone";
    self.textLabel.font = kSysFont(kFitW(13));
    self.textLabel.textColor = [UIColor blackColor];
    
    self.detailTextLabel.text = @"IOS 11.1.2";
    self.detailTextLabel.font = kSysFont(kFitW(12));
    self.detailTextLabel.textColor = hexCOLOR(@"A5A5A5");
    

    WSELF(weakSelf);
    [self  onMainSetSubViewFrame:^(UIView *view, CGPoint origin, CGSize size, CGPoint center) {
        [weakSelf.textLabel sizeToFit];
        weakSelf.textLabel.left = kFitW(15);
        weakSelf.textLabel.top = kFitH(8);
        
        [weakSelf.detailTextLabel sizeToFit];
        weakSelf.detailTextLabel.left = kFitW(15);
        weakSelf.detailTextLabel.top = weakSelf.textLabel.bottom+kFitH(5);
    }];

    
}

@end

@implementation OAMeCenterCell5

-(void)onAsInitAddView:(UIView *)view forViewController:(UIViewController *)ViewController forDataSource:(NSDictionary *)dataSource AtIndexPath:(NSIndexPath *)indexPath
{
    
    UITextField *textF = ({
        UITextField *l = [[UITextField alloc]init];
        //l.backgroundColor = [UIColor redColor];
        l.leftImageName =dataSource[@"leftImageName"];
        l.placeholder =dataSource[@"placeholder"];
        l.placeholderFont = kSysFont(kFitW(14));
        l.tag = 10;
        [view addV:l];
        l;
    });
    
    [self onMainSetSubViewFrame:^(UIView *view, CGPoint origin, CGSize size, CGPoint center) {
        textF.frame = CGRectMake(0,0,size.width, size.height);
    }];
    
}


@end







@implementation OAMeCenterheaderView

-(void)onAsInitAddView:(UIView *)view forViewController:(UIViewController *)ViewController forDataSource:(id)dataSource AtSection:(NSInteger)section
{
    view.backgroundColor = [UIColor clearColor];
}

@end



@implementation OAMeCenterheaderView1

-(void)onAsInitAddView:(UIView *)view forViewController:(UIViewController *)ViewController forDataSource:(id)dataSource AtSection:(NSInteger)section
{
    view.backgroundColor = [UIColor clearColor];
    
    self.textLabel.text = @"常用设备";

    self.textLabel.font = kSysFont(kFitW(12));
    
}

-(void)update:(id)model forTableView:(UITableView *)tableView AtSection:(NSInteger)section
{
    self.textLabel.textColor = hexCOLOR(@"B2B2B2");
    
}

@end


